﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;

namespace RaProWorld
{
    class Ltan_energyBar
    {
        Texture2D sprite_ramen;
        Texture2D sprite_leiste;
        public float energie;
        Vector2 position;
        Rectangle ramenRec;
        Rectangle leisteRec;

        public Ltan_energyBar(Texture2D newRamenSprite1, Texture2D newBalkenSprite2) 
        {
            sprite_ramen = newRamenSprite1;
            sprite_leiste = newBalkenSprite2;
            position = new Vector2(50.0f, 70.0f);
            ramenRec = new Rectangle(50, 70, 40, 100);
            leisteRec = new Rectangle(50, 70, 40, 100);
            energie = 100.0f;

        }

        public void update(GameTime gameTime) 
        {
            energie -= 0.05f;
            if (energie <= 0) 
            {
                energie = 0.0f;
            }
            leisteRec.Height = (int)energie;
            leisteRec.Y = 70 + (int)(100.0f-energie);
        }

        public void refill() 
        {
            energie += 30.0f;
            if (energie > 100.0f) 
            {
                energie = 100.0f;
            }
        }

        public void reset() 
        {
            energie = 100.0f;
        }

        public void draw(SpriteBatch spriteBatch,GameTime gameTime) 
        {
            spriteBatch.Draw(sprite_leiste, leisteRec, Color.White);
            spriteBatch.Draw(sprite_ramen, ramenRec, Color.White);
        }
    }
}
